package project.temp_no_use.WebcamTest;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamDiscoveryEvent;
import com.github.sarxos.webcam.WebcamDiscoveryListener;


public class Temp4 implements WebcamDiscoveryListener {

    public Temp4() {
        for (Webcam webcam : Webcam.getWebcams()) {
            System.out.println("Webcam detected: " + webcam.getName());
        }
        Webcam.addDiscoveryListener(this);
        System.out.println("\n\nPlease connect additional webcams, or disconnect already connected ones. Listening for events...");
    }

    @Override
    public void webcamFound(WebcamDiscoveryEvent event) {
        System.out.format("Webcam connected: %s \n", event.getWebcam().getName());
    }

    @Override
    public void webcamGone(WebcamDiscoveryEvent event) {
        System.out.format("Webcam disconnected: %s \n", event.getWebcam().getName());
    }

    public static void main(String[] args) throws Throwable {
        new Temp4();
        Thread.sleep(120000);
        System.out.println("Bye!");
    }
}

